package com.tc.controller;

import com.tc.service.CaptchaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.Map;

/**
 * @Auther: tianchao
 * @Date: 2021/11/30 10:26
 * @Description:
 */
@RestController
public class TestCaptchaController {
    @Autowired
    CaptchaService captchaService;
    @GetMapping("/captcha")
    public Map<String, Object> captcha() throws IOException {
        return captchaService.captchaCreator();
    }
    @GetMapping("/valid")
    public String valid(@RequestParam("token") String token,
                        @RequestParam("inputCode") String inputCode) {
        return captchaService.versifyCaptcha(token, inputCode);
    }

//    @GetMapping("/login1")
//    public String login(@RequestParam("token") String token,
//                        @RequestParam("inputCode") String inputCode) {
//        return captchaService.versifyCaptcha(token, inputCode);
//    }
}
